﻿using System;

namespace EmbeddedSharp.Core.Function.String {

    /// <summary>
    /// Convert the string to all capital letters.
    /// 
    /// Syntax: UpperCase(expr);
    /// 
    /// Example:
    /// expr = UpperCase("Hello, world!"); # HELLO, WORLD!
    /// echo(expr);
    /// </summary>
    public class UpperCaseNode : FuncNode {

        public UpperCaseNode()
            : base() {
            base.Value = "uppercase";
        }

        public override object Evaluate() {
            if (Parameters.Count < 1) {
                throw new ArgumentException("Usage: uppercase(expr);");
            }

            string expr = Convert.ToString(Parameters[0].Evaluate());
            return expr.ToUpper();
        }
    }
}
